#define allReviewDownLoad()
<!-- 总审页面下载模板 -->
<style>
	#alldownload {
		overflow: hidden;
	}
	
	#alldownload .modal-body {
		overflow: auto;
	}
	
	#alldownload label {
		font-weight: normal;
		vertical-align: top;
		cursor: pointer;
	}
</style>
<div class="modal fade" id="alldownload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">请选择需要下载的资料</h4>
      </div>
      <div class="modal-body"></div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary" data-loading-text='下载中...'>下载</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(function(){
		var mainDom = $("#alldownload .modal-body")
		mainDom.css("height",$(document).height() * 0.56)
		mainDom.on("click",".dir",function(e){
			e.stopPropagation();
			var dir = $(this),
				dt = dir.children("dt"),
				indent = dir.children(".indent")
			if(dt.attr("isshow") == "false"){
				//展示目录
				dt.attr("isshow","true");
				dt.children(".glyphicon").addClass("glyphicon-show");
				indent.show();
			}else{
				dt.attr("isshow","false");
				dt.children(".glyphicon").removeClass("glyphicon-show");
				indent.hide();
			}
		})
		
		mainDom.on("click","input",function(e){
			e.stopPropagation();
		})
		
		mainDom.on("click",".file",function(e){
			e.stopPropagation();
		})
		
		mainDom.on("click","label.all",function(e){
			e.stopPropagation();
			if($(this).children("input").prop("checked")){
				mainDom.find("input.check").prop("checked",true)
			}else{
				mainDom.find("input.check").prop("checked",false)
			}
		})
		
		mainDom.on("click","label.all input",function(e){
			e.stopPropagation();
			if($(this).prop("checked")){
				mainDom.find("input.check").prop("checked",true)
			}else{
				mainDom.find("input.check").prop("checked",false)
			}
		})
		
		$("#alldownload").find("button.btn-primary").click(function(){
			var $btn = $(this),
				dataStr = "",
				data = {}
			mainDom.find("input.sub").each(function(){
				if($(this).prop("checked")){
					dataStr += "," + $(this).val()
				}
			})
			dataStr = dataStr.substring(1)
			data.data = dataStr
			
			if(_x.isEmpty(dataStr)){
				console.log(data)
				_x.show_alert_sh("请选择要下载的资料！",false)
				return
			}
			$btn.button('loading')
			//console.log(_x.qsStringify(data))
			console.log(data)
			
			axios.post("/admin/downLoadAll",_x.qsStringify(data))
			.then(function(res){
				if(res.data.code == 1){
					_x.show_alert_sh("下载成功！",true)
					window.location.href = res.data.msg
				}else{
					_x.show_alert_sh(res.data.msg,false)
				}
				$btn.button('reset')
			})
			.catch(function(){
				$btn.button('reset')
				_x.show_alert_sh("下载失败，请稍后重试！",false)
			})
		})
		
		mainDom.on("click","input.dir",function(e){
			e.stopPropagation();
			if($(this).prop("checked")){
				$(this).parent().siblings("dd.indent").find("input.check").prop("checked",true)
			}else{
				$(this).parent().siblings("dd.indent").find("input.check").prop("checked",false)
			}
		})
	})
</script>
#end